package com.qf.day11;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


public class DateDemo {
    public static void main(String[] args) throws ParseException {
        String ageTime = "2002-7-29 0:0:0";
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = format.parse(ageTime); //将格式化对象转为data对象
        long time = date.getTime();

        //时间对象单位是毫秒
        long curTime = new Date().getTime();

       long result =  curTime - time;
        long l = result / 3600000; //得到小时
        long day = l / 24;
        System.out.println(l);
        System.out.println(day);
    }
}
